Fix incomplete string escaping in HTML encoder begin_line method#265
Fix incomplete string escaping in HTML encoder begin_line method#265
Conversation
Co-authored-by: korny <[email protected]>
|
@copilot Is this even necessary? The encoder controls its own output. How would we even get into the situation that the issue mentions? |
You're right to question this! While the standard CodeRay operation doesn't directly create spans with
The fix changes the method from blindly replacing the first The original issue #263 was likely reported from a real scenario, even if it's edge-case. The fix has zero performance impact and makes the code more robust. Fixed in f12b7e6. |
Summary of the fix:
The HTML encoder's
begin_linemethod was usingString#sub('>', ' class="line">')which would replace the first>character found, potentially corrupting HTML attributes that contain>characters. The fix uses regex/>\s*\z/to specifically target only the closing>at the end of the HTML tag, preserving all attribute content.Why the fix is necessary:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.